Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

I can view build results using the RTC eclipse client, but not with browser com.ibm.team.build.viewResult

I create build results using the java api, I can view the results using the eclipse client but not with the browser
https://rtc_instance:9443/jazz/web/projects/project1#action=com.ibm.team.build.viewResult&id=_OqxDUFBfEeOzj-1HuY57ug
I get he result title but nothing else, no error is reported in the browser.

When I hover on the build result in the browser, the result's information appears.

0 votes

Comments

when I use the eclipse gui, it reports the build result has no start request. Can this be the problem?

Is their any way of debuging this problem?

If I add a IBuildRequest buildRequest, I can now see most of the the build results

All except workitems associated with the results.

I add the work items to the result using

        contribution = BuildItemFactory.createBuildResultContribution();
        contribution.setExtendedContributionTypeId(WorkItemConstants.EXTENDED_DATA_TYPE_ID);
        contribution.setImpactsPrimaryResult(false);
        if ((handleIds != null) && (handleIds.length != 0)) {
            contribution.setExtendedContributionData(ContentUtil.stringArrayToContent(repo, handleIds,'\n'));
        }       
        result = buildClient.addBuildResultContribution(result, contribution,IBuildResult.PROPERTIES_COMPLETE, null);       

I do not link the work item to the build result



2 answers

Permanent link
Hi K.  The "included in build" links have a dual representation:
(1) a contribution to the build, as you're creating in the code above
(2) item links (ILink) between the build result and work item, of type  "com.ibm.team.build.linktype.includedWorkItems"

See code in com.ibm.team.build.internal.publishing.WorkItemPublisher.tagWorkItems(IWorkItemHandle[], IBuildResult, ITeamRepository) for how (2) is done.

In the Eclipse UI, the build result gets the work items referenced from the build using (1) but in the web UI it uses (2).  The links are also needed to see the referencing build(s) from work items, which don't know about build result contributions.

0 votes

Comments

I did see that in one of the examples, but com.ibm.team.build.internal.publishing      does not exists in
RTC 3 java api I can not import it.

I have the same problem with com.ibm.team.build.linktype 

Is their a diffferent way, or am I missing something in the SDK

I also can not find them in the java api doc

Sorry, that code is in the com.ibm.team.build.toolkit plugin, which is in the 4.x SDK but was omitted from the 3.x SDK.  See next answer for the relevant code. 


Permanent link

Here's the code I mentioned above.


    private void tagWorkItems(IWorkItemHandle[] workItemHandles, IBuildResult buildResult,

            ITeamRepository teamRepository) throws TeamRepositoryException {


        ILinkManager linkManager = (ILinkManager) teamRepository.getClientLibrary(ILinkManager.class);

        List unlinkedWorkItems = findUnlinkedWorkItems(workItemHandles, buildResult, linkManager);

        List links = new ArrayList();


        List workItems = teamRepository.itemManager().fetchCompleteItems(unlinkedWorkItems, IItemManager.REFRESH, null);

        for (int i = 0; i < unlinkedWorkItems.size(); ++i) {

            IWorkItemHandle workItemHandle = (IWorkItemHandle) unlinkedWorkItems.get(i);

            IWorkItem workItem = (IWorkItem) workItems.get(i);

            links.add(createLink(teamRepository, workItemHandle, workItem, buildResult));

        }


        linkManager.saveLinks(links, null);

    }


     private ILink createLink(ITeamRepository teamRepository, IWorkItemHandle workItemHandle, IWorkItem workItem, IBuildResult result)

            throws TeamRepositoryException {

        IBuildDefinition definition = (IBuildDefinition) teamRepository.itemManager().fetchCompleteItem(

                result.getBuildDefinition(), IItemManager.DEFAULT, null);


        IHelperType helperType = IHelperType.IRegistry.INSTANCE.getHelperType(

                LinksPackage.eINSTANCE.getReference().getName(), LinksPackage.eNS_URI);


        String sourceComment = ItemHelper.validateStringAttributeLength(definition.getId() + " " + result.getLabel(), //$NON-NLS-1$ 

                helperType, LinksPackage.eINSTANCE.getReference_Comment().getName());


        IReference source = IReferenceFactory.INSTANCE.createReferenceToItem(result, sourceComment);


        IReference target;

        if (workItem == null) {

            // work item is missing or invisible, so create a link but provide no comment

            target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle);

        } else {

            String targetComment = ItemHelper.validateStringAttributeLength(

                    WorkItemTextUtilities.getWorkItemText(workItem), helperType,

                    LinksPackage.eINSTANCE.getReference_Comment().getName());

            target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle, targetComment);

        }


        return ILinkFactory.INSTANCE.createLink(BuildLinkTypes.INCLUDED_WORK_ITEMS, source, target);

    }


0 votes

Comments
where BuildLinkTypes.INCLUDED_WORK_ITEMS is:

public static final String INCLUDED_WORK_ITEMS = "com.ibm.team.build.linktype.includedWorkItems"; //$NON-NLS-1$

 
A lot of the logic here has to do with shortening the comment on the work item reference if needed. If too long for the field, the save will fail.

It works

just a side note if I removed a build result using the gui, it does not remove the link form the workitem
I go to the workitem and I can not remove the link using the gui

Is their no way using the gui to remove the link?

Good to hear.  Regarding the links, no there's no way to delete them. The intent is that you may still want to know which builds a work item's change sets were included in, even if the referenced build has been deleted.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,940
× 562
× 169

Question asked: Nov 19 '13, 2:37 p.m.

Question was seen: 6,581 times

Last updated: Dec 16 '13, 1:13 p.m.

Confirmation Cancel Confirm